package itdep.common.domain;

import itdep.common.context.User;
import org.springframework.context.ApplicationEvent;

/**
 * @author $Author: ikhalopik $
 * @version $Revision: 4 $   $Date: 2010-06-10 13:13:16 +0000 (Thu, 10 Jun 2010) $
 */
public class Event<E extends Entity, U extends User> extends ApplicationEvent {

	private E entity;
	private U user;
	private Action action;

	public enum Action {
		CREATE(1l),
		PURGE(2l),
		UPDATE(3l),
		SAVE(4l),
		CLEAR(5l), //means delete event from db
		HIDE(6l);

		private long id;

		private Action(final long id) {
			this.id = id;
		}

		public long getId() {
			return id;
		}
	}

	public Action getAction() {
		return action;
	}

	public void setAction(final Action action) {
		this.action = action;
	}

	public Event(final Object source, E entity) {
		super(source);
		this.entity = entity;
	}

	public E getEntity() {
		return entity;
	}

	public U getUser() {
		return user;
	}

	public void setUser(final U user) {
		this.user = user;
	}

}